﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace MyBlog.IRepository
{
   /*
    仓储模式 通用泛型接口
    */
  public interface IBaseRepository<TEntity> where TEntity:class,new()
  {
    Task<bool> CreateAsync(TEntity entity);//增加
    Task<bool> DeleteAsync(int id);//删除
    Task<bool> EditAsync(TEntity entity);//修改
    Task<TEntity> FindAsync(int id);//查询
    Task<TEntity> FindAsync(Expression<Func<TEntity,bool>> func);
   
    Task<List<TEntity>> QueryAsync();//查询全部数据
    
    Task<List<TEntity>> QueryAsync(Expression<Func<TEntity,bool>> func);//自定义条件查询

   Task<List<TEntity>> QueryAsync(int page, int size, RefAsync<int> total);//分页查询

    Task<List<TEntity>> QueryAsync(Expression<Func<TEntity, bool>> func, int page, int size, RefAsync<int> total);//自定义条件分页查询

    }
}
